#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main()
{
    int n = 0, s = 0, k = 0;
    scanf("%d%d%d", &n, &s, &k);
    getchar();

    int next[10002] = { 0 };
    int i = 1;
    for (i = 1; i <= n; i++)
        scanf("%d", &next[i]);
    int x = s;
    for (i = 0; i < k; i++)
    {
        x = next[x];
    }
    printf("%d", x);
    return 0;
}